Started refactoring of newdbinterface.go into keyvaluedb.go