Debug partially working, xtrace broken.

* Add contains function for substring match.
* Debug switches correctly.
* Not sure why xtrace fails to set in function.