General code tidy