Corrected small typo in comment.
Removed unneeded line.
Internal cleanup and reordering. Added function documentation and removed "--debug" option. This is now controlled by the "_GSAT_DEBUG" env variable.