fixed db problem

seperated db to seperate file