moved some client logic to server