Finished compareTo method