Commended flattening code