Improve file extraction process with extensions and correct minor bugs