integrating many updates from the truthcoin project