Added function swapAndReconnect()

* Function basically swaps nodes and makes sure the in nodes swap appropriately as well