Added checks for whether page is connect. changed global variable name. added devel check to catch bad URLs.