minor reorg, add sleep mode
simplify