reorg and simplification of the THTP protocol