Added recursive method to get page numbers