Added compactness function.