updated main method