code for factory and their return types post