Cleaned up code and reduced state in main class