main method work