Fixed JSLint errors, fourth pass (scope and undefined entities errors).