Implemented receive message function