added button and reed switch debouncing