Updated comments

Added comments to describe the overall purpose of the script and the
individual functions.