refactor: remove globals from main

Reasoning was particular hard with package global variables. This change-set provides extensible types for the main actors in main.