extract setfenv to own method