Cleaned up and commented main