Refactor code

-Added setter getter for receivedBytes
-Added more comments