better map edit logic