Added constants to the top of script. Added a try catch statement in the findPageNumbers function in case exception is called.