Separate writing function from put_data()
Merge branch 'feature/reorg' into feature/image
Allocate memory for out_data_struct