implement and test make-ranges function