Made thread safe by adding dbconnection factory as dependency rather than dbconnection