Delete function is running slow