improved efficency of delete algo