Replaced "== None" with "is None" and similarly for "is not"