Refactored to use Comparable module.