Move processing code of corpus into extra script