tidy docs and remove unused code