Added an extensive java-docs to the code, making it easier to read.