Move window.location to a globally accessible func