Refactor ivan's code (aa4b684d0682ff9faf1577653fa5ceabbc6e0f20) to remove the time.sleep. - Resolves: #7414