Moved some code to a new method in papi page