Hello!

Perhaps the following pseudo code can help you too. I am using it for my own doubly linked list.

However, it is assumed that there are already functions to cut and insert list elements.

Code:
function: swap elements a and b

IF a is successor of b THEN
	cut b and paste it after a
ELSE IF b is successor of a THEN
	cut a and paste it after b
ELSE
	remember predecessor of b
	cut b and paste it before a
	cut a and paste it after remembered predecessor of b
	if b was the first element paste a at the front of list


I dont know how your implementation works, so the above code my be completely incompatible with yours.^^