Clean up a bit.
Start conversion to typescript.
Major refactor to typescript.