Added writing output in get_results method