Performance improvements.

Performance improvements.