added add_before_node function