Changed to use more explicit None-checking.