JS tidy-up