refactor window.location