removed some useless code and main2 added