Moving the factory function of createNetwork