Some updates so this works in IE<10.  JavaScript cleanup and refactoring.