- Make the poll wait random.
- Better encapsulate the main() logic.
- Depend less on globals, to make it easier to move things around.