added if statement wrapper around pushState logic