Clean up deprecated functions, non-performant JS, and global variable references
Remove another user global
Output escaping on setting spage