Removed Array#sort_by! call because not supported on Ruby 1.8.7