Integrated TDB and added simple test for it.
Code cleanups