More code cleanup/tweaks
Added support for matching undef values