Update to get it to work better with window.location.pathname