optional leveldown + lots of cleanups