Cleaning up the code