Updated various documentation info so that they are now accurate
and slight tweaks to code for correctness.
various changes to docs and slight code tweaks