Training LLMs to Better Self-Debug and Explain Code