Code cleanup

Clean up some var declarations and make some things more readable.