initial commit of db module, currently fully functional