refactored some methods, added documentation for all methods