Fix selecting a pairs in the heat map

I altered the finding things in a range by having it return the data of the
selected elements. This is a cleaner and more useful interface. In addition, I
fixed the problem in finding the endpoints of the range. Currently it does not
do any error checking but it at least works when given a pair that implies a
valid range. There are some inefficacies in the program which lead me to think it
would be better to represent the data as a matrix, and not a list as it is now.