Refactor sending/receiving