Re-formatted and made tiny changes to packet sending.