The chemistry of charging and discharging lead-acid batteries