Introduced error listener for connection
Reformatting and restructuring
Finishing work to move replication function to the new receiver functionality. This will provide consistency and flexibility. Need to be tested thoroughly