modified so it outputs a bunch of stuff to check where the code crashes on Thorn!