better support calc, added function to assign branch based on left/right splits