for(String state in errorStates.keys) {

A lot more efficient