Added returncode and string substitution from environment vars