preprocess_data function

Preprocess data