improve ui / edit toggle logic