Mavenized and addet JUnit testing. A little more refactoring