Simplified, added debounce for pir