Add support for recursive types

Implements API that may resolve issue #379