Added environment (sandbox and production) support in the constructor