before refactoring
it works
refactored