Fix sorting handler

The `compare(a, b)` function passed to `Array#sort` expects `0` if both elements are equal, less than `0` if `a` should come first, and greater than `0` if `b` should come first.

Previously, values less than `0` were never returned, causing the sorting to be wonky.