Refined the structure and fixed a bug where i had the size of the packet wrong