all_identical as a separate function