Some performance improvements