Small refactoring and documentation.