Added ptb exception class and started moving code from ptb functions to page type class