Added code to switch Thomas CoaSim hack for obtaining leafs on and off by setting a global variable.