Performance improvements, and bug fixes
Merge pull request #4 from DarkArc/perform

Performance improvements, and bug fixes. Thanks @DarkArc !