Updated serialization to work with Maps