tested with some number of inputs, seemed to work fine