Reverted code changes from previous commit to remove JS errors.

And fixed some issues with the JDG tutorial.