Taking UI JavaScript out of HTML into tool.js. Turning it into TypeScript. Adjusting the compilation (including pe.d.ts for tool.ts to use).