Switch from setTimeout to listening.