Updated build_magic_packet to remove ugly hack and replace with Ron Collinson's method