move script up before environment declarations