Few optimizations
Merge pull request #3 from Sobak/master

First optimizations

* Sobak/master:
  Few optimizations