Cleaning the code up