Bug fixes and javadocs

fixed a bug with the stats generator and wrote some javadocs. Also,
started unit testing.