Finished db framework
Merge Joel's changes