Improve code quality, Also add javadocs to JUnit test