Cleaning up code and moving things around.  Tested it produces SQL based composites.  Added STDOUT debugging and logging to STDERR