Clean up funny code and initialize variables.