Finished algo to get main rings