Adds "sample" event. Cleans up (and fixes) interrupt code. Adds test script.