refactored code into separate modules