Some fixes; preliminary pagination support