In previous commit accidently added the pointer delete inside the
forloop instead of outside forloop