Update

Switched to external modules, use require to load modules, update for
latest TypeScript version.