Replaced popstate+pushstate with switchstate