Refactored some code
Added packet system