got a working 3 parameter function