refactored into modules, added private method, and added first documentation