rewrite function with more parametors