Improved command-line interface for the test script along with improved code documentation and some clean up.