Changed palloc calls to use paging flag as needed