nicetraj: simplify range code; add range tests