Changed ordering so that required files are added at the very end.