Updated main method