Added functions and comments to the stub, per the assignment.