battery unknown state + code cleanups