Refactoring + output is now ordered by file extension.