stack limits, max traces. cleaned up main
write output file