more refactoring of process method