add mam query functionality (more to come)