Extract factories to separate file