Add support for custom types

Moved regular expressions, buffers, dates and functions to custom types.