implement flatness(not working atm)