Move magic bytes reading to use deserialization module