Error classes inherit from StandardError.
Escape the keywords before joining them.
Define a var for the number of pages.
Store main page in pages variable. Tidy up loop over pages.