code for server