refactoring 2
refactoring 3
refactoring 4 - replace switch with polymorphism