Tidy code a bit