How Vishwamitra Became Bramharishi ?

King Kaushika was very arrogant. He misbehaved with maharshi Vashishta ...but became Maharshi.How?