Documentation and refactoring!