speed up swap gate routine. #19