Reduce technical debt and add JUnit