More main cleanup