added support for factories