architecture improvement + unit tests
Merge pull request #5 from mhor/unit_test

architecture improvement / unit tests / cs fix