rework of environment data structure - supports parent environments now