refactored code, added documentation