moving database control to config