refactor: split out and clean up the erase command.