Added function data_preparation()