This will NOT be drop in code for your purposes, however it makes use of the timeout timers I was referring to…