For comprehension with flatmaps now.
Changing to main()
Shudown on events.