Added the reconnect feature. Also firing activityTerminated event