Synced with 5.22.103 merged source version.

There were a couple of javsacript errors with missing varibables. Fixed those and added in a method that I put in right before your merge.