Cleaning up some code