Simplified code in plugin.rb