added JUnit test framework, reorganized code into subpackages and main/test code
manual merge conflict resolution