minor refactoring for orders processing