Further JUnit tests
Merged code/common changes
Small fixes