Added writefiles option