move environment functions to object.c