Hacked in usage of extended p square algorithm from boost library.