Added callbacks for message/delete/beforeconnect
Added support for disconnect code & messages

In addition to a lot of refactoring