move packet stuff to separate file, make shutdown cleaner
fix