Implemented node swapping