clear any whitespace and move variables to top