Move factories to separate files