Added a lot of javadoc and made a couple of variables private