Move serialize functions into serialize.c
Move deserialize functions into serialize.c