Added a small clause to the query implementation so we can use them for exposing devices as well.
Added a small if clause to wrap just providing a string in a query.