refactor process method