Add deactivate handler

Fixes #14