add comments
add generalised functions to change button or switch state