Changed window.location to window.open