refactor and documentation.