complicated server stuff