Minor improvements on debugging code