Updated main method.