needed to reference the period num, not the index num
problem in incrementing prd p