refactoring the code and separating sender and receiver