+1 to the end of the range
cleaned up formatting. Fuction looks to work properly.