Refactor prt command logic.