Check the range in a seperate function