tidy code a bit