use range
tidy up - and add more test