Refactoring and docs.