fix up tables for nice coding
reworked tritable
includes code to generate pruned table from data
clean up code, small api changes