Refactor pagination position