Refactoring doProcess()