now outputs to a file