Fix memory leaks. Lib can't have function def last
Replace dataInListAtPosition with a walking node