Tests, typos, javadoc and code reformat.