manage query manually