update with more pages and simpler code