Generate trace functions parameters
Generate trace function body
Improve output