Can we make that a separate function, and automatically use the input URL when referrer is not set?