lots of documentation and a few agent fixes