Some cleanup and debugging on Thxgen