Add main method injection for direct testing