unfinished refactorings
Merge pull request #1 from shadchnev/master

Made some refactorings, unfinished