moved DB layer out of main server app