finished client logic