prepare_data function

Prepare data in a standardized format