Early evolution of the Earth: Accretion, atmosphere formation, and thermal history