Refactoring processoring logic