refactor commands.rb