Refactor private functions out of CLI prototype.