making the output as a function