More code tidy-ups