Clean up old files and reorganize factories