changed extract_pages method signature