doc and tidy up