tweaked version of zaprange plugin - see #439