Adds finishing touches and test for the polycals algorithm.