performance optimization and improvements