implemented main method.