rewrited main method