Adds factory function