documentation and tidying