Cleans up the code a bit