added if/elsif statement, modified controller.rb and