Re-wrote pagination section