fixed bug
divide into several files