prepare_data function

Prepare source data