replace insert function with delete function