change output to a function