Adding code to authenticate connect event using auth_token. Also fixing few bugs.