added edit flag function