Refactoring, and some basic packet validation
refactoring, WIP