Moving extraction to external file