switched from Map to IORef for the environment