Added isNil function