start of location server code