Cleaning up a bunch of code