use ~ range for when
Merge pull request #10 from tkellen/fix-when

use ~ range for when