Added conditional for pagination.