Fix Base#hookFor() method and cleanup invoke fix

Add Environment#duplicate() to create performant copy of a complete
environment.