Moved definition of DEFTYPE and adapted to new environment protocol.