Move factories into a single file