use globalenv() instead of .Globalenv; remove local()