Change with_env to a function
Merge pull request #45 from ericmj/withenv-function

Change with_env to a function