Phase 1 - pass env as -D option + small refactor