implement output to file