added range helper function