getting db layer working