Updated battery code.