pass environment as a variable instead to save duplicated parsing effort