refactoring: reduced by 60 lines of unneccessary if tests
refactoring session