update the main method.