probably more correct, now includes final states