All the C++ work done by Tim Molteno <tim@physics.otago.ac.nz>
Greatly facilitated by the C port of N. Kyriazis.