Extended querying API

Added querying function implementing alternative approach to dealing
with multidimensional output.