Improved code to find #main.