Performance refactor
Merge pull request #1 from d13/master

Performance refactoring