--- a/lib/Panotools/Photos.pm
+++ b/lib/Panotools/Photos.pm
@@ -164,16 +164,14 @@
         my $et = $image->{exif}->{ShutterSpeedValue} || $image->{exif}->{ExposureTime} || $image->{exif}->{ShutterSpeed} || 0;
         $speeds->{$et} = 'TRUE';
     }
-    return [sort {_longer ($b, $a)} keys %{$speeds}];
-}
-
-sub _longer
-{
-    my ($A, $B) = @_;
-    if ($A =~ /^1\/([0-9]+)$/) {$A = 1 / $1};
-    if ($B =~ /^1\/([0-9]+)$/) {$B = 1 / $1};
-    return 0 if ($B > $A);
-    return 1;
+    return [sort {_normalise ($b) <=> _normalise ($a)} keys %{$speeds}];
+}
+
+sub _normalise
+{
+    my $number = shift;
+    if ($number =~ /^1\/([0-9]+)$/) {$number = 1 / $1};
+    return $number;
 }
 
 =pod