Formatting, and moved the tmp variable to the top.