change state to struct