Order management - refactoring code