I'm assuming that the first property has been let pretty much continuously since you first moved out.
The main residence election hasn't been withdrawn. It was planned to be withdrawn but the government changed its mind.A property cannot be your main residence if it is let. An election for a property to be treated as your main home can only be effective if you have more than one property available to you to live in. Whilst a property is let, it isn't available for you to live in.You use the original purchase price to calculate any gain. As the first property was both your main home and it was let, you will be entitled to letting relief for the letting period as well as main residence relief for the period that you lived in it and the last 18 months of ownership which may or may not cover some of the letting period.The only way you can save tax is by not selling the property or selling it when you are not a higher rate taxpayer so that at least some of the gain will be taxed at 18%. If you put it into joint names with a spouse or a civil partner, you may save some tax but you may lose out on main residence relief and letting relief.As far as I can see, the second property has been your main home since you bought it so any gain will be exempt from CGT if you sell it having lived in it for all of your ownership of it or within 18 months of moving out.Take a look at HS283 for information on the main residence and CGT.I hope this helps but let me know if you have any further questions.