added more untested code to read pushbuttons in an infinite loop