Some cleanups within the sender.

Now the code should be more readable.