Remove unused code
Fix duplicate sending of data