Optimizations +more database caches + bug and style fixes