currentPage now a global variable