Add packet class and fix naming conflicts
Refactored code to make more sense