Logic is the same, just if statements are a little bit more complex (they need to check both flag values)