Added support for custom refs