minor improvements
Performance improvements and some cosmetic changes
Merge pull request #1 from bashor/master

Performance improvements and some cosmetic changes