partly refactored db module, add callback interface