Modernized LTI JavaScript code.

A proper constructor. All functions are now in the LTI object's prototype.
The idea is to make it easily testable.