abstracting callback using env vars