More refactoring, added first tests, fixes
Merge pull request #6 from vhordejcuk/master

More refactoring, added first tests, fixes