Clean up the code in parse-range