message serialization and login implementation