Update wam.py

Added comments to wam.py as well as documentation on the two
internal functions.  Left a todo statement near the bottom,
the solution to which will take some consideration.