added erase and add entries properly and write to config file is any changes