fire button click event only once

and reduce code redundancy