change the `int t` parameter by `int type` as well