Mecanim Animation won't stop looping.

Hello,
I have set up a walk/run cycle for a Character that I am playing with. I am having an issue where on touch input the Mecanim transition will take place (playing the animation) but the animation will not stop looping, but it will transition back to the Walk/Run start for 20 frames and loop back into the animation. But if I touch the screen again the animation will stop playing and return to the walk/run state of the Mecanim animation.

I was wondering whether I was using the wrong touch input, I am using this:

	//Touch Input Jump
	foreach (Touch touch in Input.touches) 
	{
		if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
		{

or there was something wrong with the way I have setup the Mecanim.

I managed to fix the issue with the looping animation. I had put the else statement in the script in the wrong location in association with the touch input, but as soon s I had fixed that everything started to work like a dream.