move the code from below into functions, so install can reuse them if it can't call initdevice directly.  Not the best, but not the worst.  Could make a condition in initdevice NOT to fail if the device object exists...