add a pagination method.