Cleanup and reformat of main class