workign on serializing state