Tidy-up code with CodeNarc suggestions