refactoring, rewrites, polishing, docs