working main method