wrote output functions