Debug recording efficiency

+ some code commenting.