Performance optimization

Minor changes for performance optimization.