minor refactoring, documentation for all classes and methods