Rewrited some code
Removed Mode class
Merge pull request #3 from Pishka/master

Code was rewrited