Cleaning up and added java docs.