javadocs, fixes and better tests