More code for 3.20 (not yet correct)