Documentation and general tidy up