Replaced the use of callbacks with a general listener object. KernelConnection will forward messages to the appropriate listener.