Added disconnect handler

Closes #21.

This took way too long, heh.