Tweaked code

Made some code tweaks and polished up JavaScript for iOS push.