Save onNewState the distance to all other states in sfg
Save a list of states in which order the where inserted in the sfg
Algorithm for the callback function of the threshold slider
Minor fix