changed onchange args to pass state instead of just name