tidy up and add generator