Tidy up code in line with guidelines