updated to new flag functions