Moved serialize and desearlize to header file