add database connect stuff, needs debugging/testing