Perf improvements.
Merge pull request #1 from totherik/master

Perf improvements.