popstate needs to come after function definition, duh