Refactored packet transmission out to separate function, created
transmission thread.