Rewrote receiver error handling and added specs for Receiver. Fix #1 and #2