now exporting convert.to.factor function