replaced add_states function with set_states