Refactor process to command