added supporting functions for factory function