Neaten up code a bit