modify compareTo function in practice4