finalize_explanation function

Gathers the final output to create the explanation object