refactor sendData function