implemented basic query system