Reorganized code into library, executable and a test suite.