Added Java Docs and organized functions