Fix #174 with single shot

And updated sample to add a single shot demonstration
Refactor single shot out