Main method.