Refactored ability.rb for readability