changed insert to check if insert occurred.