Second rewrite of main class