better handling of client disconnects
update to new query builder