Refactor of the main begins...