Modify extract to remove extra \n