The early evolution of the giant planets