Improved query and wildcard support