Moved the wait function of pacemaker in the pacemaker service.