minor improvement to use ClassEntityComparator to compare