merged timing code with onPollStop() code