Merge pull request #2 from wagnert/master

Performance optimizations