More documentation and refactoring
More documentation and refactoring