structered server code