Added numPages instead of hard coded number