add a main,and tested codes