Added compareTo function