Various fixes and starting test cases
Merge pull request #6 from wtg/4_1_dev

Various fixes and starting test cases