Implemented working compareTo