coded last function for receiver