jigtest working finally, code needs cleanup