API: environment parameter changed to env.

Extracted the full environment creation to base class.