Merge pull request #587 from angel-kulikov/master

UPD: рефакторинг по #528
Merge pull request #588 from angel-kulikov/master

UPD: рефакторинг по #528
Merge pull request #34 from yupe/master

UPD: merge with yupe/master