Add result set writing stuff