improved server script