Refactoring and inf loop on run of sender