Tidy a bit of code