this should be done only for the flat format