Updating code with smart detection and call parameters to specify
environment