Move function to output_handling

Combine all the add_to_xxxx ..