Move factory classes into separate files