tidy up and document