refactored updateWaiters for interval and timeout functions