Switch to use an environment to keep track  of objects

* environments are never duplicated so this takes care of the problems with
  not being able to set slot contents from inside methods