Tb clean up

This pull request groups al the previous TB pulls request plus adds additional work, so that reviewers just need to look at one place.

Apart from cleanup (much more is needed btw) there is also a small optimization when not using TB (TCEC) becuase now we don't calculate number of pieces in search in this case, so i suggets to merge before next TCEC round.