prev_node function & tests