Some improvements on paginating logic, still in very early stage