Updated after feedback on PR.
Adding javadocs.