Split loader.ts in several files
Use lambdas instead of "that = this;"