main method updated