Put pattern conditional in the correct place.
Also removed leftover debug statement