Cleaning and organizing the flow of code