[refactor code] refactored read and send threads