Documentation and tidying up