added button debouncing functions and test cases