Remove some old cruft, fix up build, use kv/ abstraction