final version - added docstring. also corrected typos - Grant