Planetary Formation and the Early Earth