More cleanup of js and prep for phonegap