minor changes; add javadocs and comments