challenge update

simplified code into 2 methods: one for switch and one for buttons