Fixed it so it now updates page counts without need to refresh the page.