Docs; minor refactoring