added logic for all buttons

added logic for all buttons