Tidy up code to match style