v0.4 major db optimizations