Move compilationunit creation to factory class