Refactoring and more structure for transmitter code