Split code in main