add some performance improvements.