Trying to optimize the 3d PAN solver [1]