Moved page flush out of the loop and pass it only the page number