Use common code for previousSibling and nextSibling