refactored code
split code into specialized areas