Add Receiver functionality to Master

Cleans up code and adds the functionality of the receiver to the master.