change to id key and add manager to environment
move env_open and env_close into their own file, they are too big