Use isNothing instead of (== Nothing)