Added logic and tests to check for valid jsonpVar