Made little optimizations to code
Merge pull request #12 from elgis/opitimizations

Made little optimizations to code