Adjusted code to use new PA calculation