No more busy loop, now uses events for less CPU usage