This is probably thread unsafe.