Feature/with env

Hi there,

this is the PR including `#with_env`-functionality. It is based on the work done in #186. I also added a test for the method.

Cheers