Cleaned and Commented Receiver Code