Additions to query

Some kinks still need to be worked out but the class's new code is
functional.