Cleaning up code to be more organized