Made curPage tracking more efficient