Refactored compareTo variable