Refactored cli.rb