Implemented compareTo method based on score