Fix issue with relative/absolute paths. Also make it so that files are output in the order in which they were inserted.