Added seralization code, also updated cmakelists.txt