improve server script