Add unit tests for debounce. Scheduler fix.