refactored to include Comparable