finalized serialization on end. need to add deserializarion