Add existing GAM 3.21 code