Define ref classes in new environment