added final version of extract and output.txt