Added batterycheck function