updated index delete logic