tidy up functionality