Added tests
Merge pull request #37 from vasichkin/testing

Minor fixes, added tests.