cleaning up code- main