Cache optimization and bug fixes.