Implement deleteNode method