Bugs all fixed, code clean up on main class