Add a new page count function (not working yet)