Refactored method in idea.rb