moved environment detection after collecting env vars + added utils.sh