minor fix, checked for global being set before using it
minor doc block
lots of unit tests, need more