emmax_w_two_env() function added