Recoded the pager to use lua registry functions, needs testing