refactoring reduce action