changed packet writer to support multiple targets