Implement custom handlers, improve demo

Fixes #1