Add comments to functions in mining.py