how does a star become a main sequence