add flag function to UI