Add the `debug` mode and note timeout

Fixes #229
Merge pull request #246 from janko-m/improve-debugging

Add the `debug` mode and note timeout