refactored packet stuff into separate files