factored db to db folder, put it in with some db utilities