Implements defclass

This fixes issue #156