Training code.