refactor processing