Enhanced main method.