got rid of nasty type redefines, added get sorted keys to rv
graphs!
added minor error check