Main function work well

Main function work well, and I will modify it laterly.