Slight tidy up of code