cleanup, unit testing improved, more comments. phaselib.c no longer dependent on a hacked nadc_tools.