checkpointed by sklower, after hacking a start routine and enpget.