tidy-up code