mostly from keithw's zephyr on -c sipb