Refactor some object instantiation into factory methods