Rewrote gaussian packet function