Fixing issues found by Anton during review of PR 804.

Changed use of IDs to classes. Simplified lti.js - now simple one function.
Updated tests.