Did some refactoring
Added packet handler