adjusted code for fresh batteries