Added some Javadoc and some debugging statements.