Added support for custom derivatives