Move environment declaration to stage blocks