Code cleanup: Replacing comparison when dealing with None