queries handling