added function to retrieve the Environment from metadata