Adding states, fixing mutex access.