Battery functions in a library