Implemented smarter logic support for search
Fixed problem with undefined values