Improved java doc and added more tests