working on button-handling routine and turnoff function