Cleaning up code a bit