Changed packet to short and moved variables