refining our button's click event for different cases