Fixed a few bugs and lots of doc updates