reordered external files and added missing license agreements

(cherry picked from commit 0869f9e166ed80d103cb896359c3d5f5bf7478a7)