added support for single-shot mode per issue #23