replaced for loop with range function
removed unused variable
fixed some bugs. updated test cases
refactored variable names
added getter + setter for currentPage field
updated example