Added support for pagination