added data preparation code