added better state and action matching