Documentation and tidy up