First iternation of KDB, with working unit test code