Make battery optional; detect output from ztream; more robustness