Rename onDisconnect to appendDisconnectHandler
Make sure to call cleanup
More resilence to handlers crashing