Small refactor to main.