pass the state as parameters