Made some performance improvements.