adding url swapping logic