Control of Dendrites in Rechargeable Batteries using Smart Charging