restructured BBM to work with different number of input parameters