changing to 0-based pages and more