reorg and create unit tests for key value implementations