added comments to functions that return functions.