update
refactored events and handlers
added complementary stop reconnect function
added stop reconnect attemps call
added another condition when passing through data message
update