improved repaginate class