make common queries release connection
rewritten frontend, crudely working