refactored packet class