stored connection for each worker
moved db functions to separate file