add size management and change serialization method