removed local declaration of currentPageIndex, which is already declared in header file