Improved df writing