improved file writings