Refactor data sending