inital refactoring solution
added more refactoring details