Replace direct constructors with static factory.