restructuring and modifying

*organized the code structure
*add reset button event
*add externally click event