now loads DB info from config, fixed some bugs