updated delete code