Added the rest of serialization (needs testing)