Added flag stealing logic.