Sweeping changes

Rewrite to TypeScript, structure things a bit more clearly, add in
Phong shading