Why have the same if conditional twice in a row?