how did the sun and planets form in the first place