Added comments to error function.