separating functionality to button clicks