tidy up code a little bit