redesigned serialize mechanism