It's now almost as good as the CLI!

register callback needs improved error checking
Fixed the register callback to send an error message on failure
Now with less segfaults