tbg_calc() finished

tbg_calc() finished and tested