Added function to handle all server calls