Added functionality to edit states