Improve return URL creation