battery function